package com.wthink.newMain.settings.config.inner.netconfig

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import androidx.fragment.app.Fragment
import androidx.fragment.app.viewModels
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import com.wthink.hzgj.R
import com.wthink.hzgj.databinding.FragmentNetconfigListBinding
import com.wthink.hzgj.util.adapter.BaseViewHolder
import com.wthink.newMain.settings.config.inner.netconfig.adapter.NewNetConfigAdapter
import com.wthink.newMain.settings.config.inner.netconfig.viewmodel.ConfigNewListViewmodel

class ConfigNewListFragment :Fragment(){
    private val viewModel by viewModels<ConfigNewListViewmodel>()

    private lateinit var binding: FragmentNetconfigListBinding

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        binding = DataBindingUtil.inflate(
            inflater,
            R.layout.fragment_netconfig_list,
            container,
            false
        )
        binding.viewModel = viewModel
        binding.lifecycleOwner = this
        return binding.root
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        binding.netconfigList.layoutManager = LinearLayoutManager(
            context, LinearLayoutManager.VERTICAL, false
        )

        viewModel.getNetConfig {}

        binding.netconfigList.adapter = object : NewNetConfigAdapter(

        ) {
            override fun onBindViewHolder(holder: BaseViewHolder, position: Int) {
                super.onBindViewHolder(holder, position)
                val itemView = holder.itemView
            }
        }
    }
}